import React, { useState, useEffect, Fragment } from 'react';
import { Button, Divider, message, Table, Select, Space, Card, Form, Row, Col } from 'antd';
import Api from '@/api';
import Edit from '@/pages/content/lanMu/Edit';
import { QueryFilter, ProFormText } from '@ant-design/pro-form';
import styles from '@/pages/content/lanMu/index.less';
import StandardTable from '@/components/StandardTable';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import { PageContainer } from '@ant-design/pro-layout';


let IsAddPID = '';
let formData = {};
let PID = '0';

const TableList = (props) => {
  const [selectedKeys, setSelectedKeys] = useState([])
  const [PageData, setPageData] = useState({
    pageSize: 10,
    pageIndex: 1,
    ViewModelList: [],
  });

  const columns = [
    {
      title: '姓名',
      dataIndex: 'Name',
    },
    {
      title: '性别',
      dataIndex: 'SexDesc',
    },
  ]

  useEffect(() => {

  }, []);

  // 获取列表
  // function GetList(v) {
  //   Api.LanMu.GetCatgPage({
  //     pid: PID,
  //     name: '',
  //     ...formData,
  //     pageSize: PageData.pageSize,
  //     pageIndex: v ? v.current : PageData.pageIndex,
  //     officialID: OfficialID,
  //   }).then((res) => {
  //     if (res.Ret === 0) {
  //       const data = res.Data;
  //       setPageData({
  //         ...data,
  //         pageSize: data.PageSize,
  //         pageIndex: data.PageIndex,
  //         ViewModelList: data.ViewModelList,
  //       });
  //     } else {
  //       message.error(res.Msg);
  //     }
  //   });
  // }

  // 查询
  function handleSearch() {
    // e.preventDefault();
    // const { dispatch, form } = this.props;
    // const { userRoleId } = this.Gather

    // form.validateFields((err, fieldsValue) => {
    //   const values = {
    //     ...fieldsValue,
    //     userRoleId,
    //     scdate: publicMethod.onUTCTime(fieldsValue.scdate),
    //     ecdate: publicMethod.onUTCTime(fieldsValue.ecdate),
    //   };
    //   this.setState({
    //     formValues: values,
    //     isLoading: true,
    //   });
    //   dispatch({
    //     type: 'RoadLine/GetPageRoadLine',
    //     payload: {
    //       ...values,
    //       pageIndex: 1,
    //       pageSize: 10,
    //     },
    //   }).then(() => {
    //     this.setState({
    //       isLoading: false,
    //     });
    //   })
    // });
  };

  return (
    <PageContainer>
      <div className={styles.search}>
        <QueryFilter
          labelWidth="auto"
          onFinish={async (values) => {
            formData = values;
            GetList({ current: 1 });
          }}
          onReset={() => {
            PID = '0';
            formData = {};
            setSelectedKeys([]);
            GetList({ current: 1 });
          }}
        >
          <ProFormText name="name" label="栏目名称" />
        </QueryFilter>
        <Table
          columns={columns}
          dataSource={PageData.ViewModelList}
          onChange={(v) => GetList(v)}
        // loading={{
        //   spinning: isLoading,
        //   tip: '数据正在查询中，请稍候...',
        // }}
        />
      </div >
    </PageContainer >
  );
};

export default TableList;
